/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.workprocedure.service.impl;

import com.jeesite.model.exception.InvalidParameterException;
import com.jeesite.modules.workprocedure.service.IWorkProcedureService;
import com.jeesite.model.dto.ParamPageDTO;

import com.jeesite.util.ExceptionUtil;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jeesite.common.entity.Page;
import com.jeesite.common.service.CrudService;
import com.jeesite.modules.workprocedure.entity.WorkProcedure;
import com.jeesite.modules.workprocedure.dao.WorkProcedureDao;

/**
 * 工序表Service
 *
 * @author gzm
 * @version 2019-06-15
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class WorkProcedureService extends CrudService<WorkProcedureDao, WorkProcedure> implements
    IWorkProcedureService {

  @Autowired
  private WorkProcedureDao workProcedureDao;

  /**
   * 获取单条数据
   */
  @Override
  public WorkProcedure get(WorkProcedure workProcedure) {
    return super.get(workProcedure);
  }

  /**
   * 查询分页数据
   *
   * @param workProcedure 查询条件
   */
  @Override
  public Page<WorkProcedure> findPage(WorkProcedure workProcedure) {
    return super.findPage(workProcedure);
  }

  /**
   * 保存数据（插入或更新）
   */
  @Override
  public void save(WorkProcedure workProcedure) {
    super.save(workProcedure);
  }

  /**
   * 更新状态
   */
  @Override
  public void updateStatus(WorkProcedure workProcedure) {
    super.updateStatus(workProcedure);
  }

  /**
   * 删除数据
   */
  @Override
  public void delete(WorkProcedure workProcedure) {
    super.delete(workProcedure);
  }


  @Override
  public Page<WorkProcedure> listProcedures4Page(ParamPageDTO page) {
    return null;
  }

  @Override
  public void deleteById(String proId) {
    ExceptionUtil.throwCmsException(null == proId, InvalidParameterException.class,
        "fail to delete procedure, cause proId is null");
    workProcedureDao.deleteById(proId);
  }

  @Override
  public void saveProcedure(WorkProcedure procedure) {
    ExceptionUtil.throwCmsException(null == procedure, InvalidParameterException.class,
        "fail to delete procedure, cause proId is null");
    workProcedureDao.saveProcedure(procedure);
  }
}